/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package modeladesktop.algoritmo;

import org.apache.commons.math.MathException;
import org.apache.commons.math.stat.inference.TestUtils;
/**
 *
 * @author Alvaro
 *
 * Estado: INCOMPLETO
 *
 */
public class RegressionAnalysis {

    public double mu=2.5d; //!?
    public double [] coeficientes = {1d,2d,3d};

    public RegressionAnalysis(double [] coeficientes, double mu){
        this.coeficientes=coeficientes;
        this.mu=mu;
    }

    /*
     * Obtiene el valor de T
     */
    public double getTValue(){
        return TestUtils.t(mu, coeficientes);
    }

    /*
     * Obtiene el valor de P
     */
    public double getPValue() throws IllegalArgumentException, MathException{
        return TestUtils.tTest(mu, coeficientes);
    }

    /*
     * Evalua la hipotesis
     * True=Hipotesis nula rechazada
     * False=Hipotesis nula aceptada
     *
     * el valor de la significancia (Alpha)
     * debe ser menor o igual a 0.5
     */
    public boolean getResult(double significance) throws IllegalArgumentException, MathException{
        return TestUtils.tTest(mu, coeficientes, significance);
    }

}
